#encoding=utf8
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app

from utest_task import FaintTask
from rpc import TaskRPC

import os

class Simple(webapp.RequestHandler):
    def get(self):
        template_values = {}
        path = os.path.join(os.path.dirname(__file__), 'templates', 'simple.html')
        content = template.render(path, template_values)
        self.response.out.write(content)


application = webapp.WSGIApplication([
        ('/rpc/(\S+?)/(\S+?)/{0,1}', TaskRPC),
        ('/rpc/(\S+?)/{0,1}', TaskRPC),
        # ('/test/js', JsTest),
        ('/simple', Simple),
        ('/(.*)', FaintTask)
        ],
    debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
